package com.bems.pojo;

import java.sql.Timestamp;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import com.bems.common.UtilEnum;

/**
 *  清单
 * @author 陈磊
 *
 */
public class List extends POJO 
{

	/**
	 * 
	 */
	private static final Long serialVersionUID = 1L;
	private String number;
	private String stocknumber;//库存编号
	private int status = UtilEnum.List_Status.Storage.getValue();//入库状态，1：入库 -1：出库 0：报废
	private float quantity;
	private float price;
	private Timestamp createtime = new Timestamp(new Date().getTime());
	private Long type_id;
	private Long user_id;
	private Long admin_id;
	private Long warehouse_id;
	private Long supply_id;
	private String note;
	public String getNumber() {
		return number;
	}
	public void setNumber(String number) {
		this.number = number;
	}
	public String getStocknumber() {
		return stocknumber;
	}
	public void setStocknumber(String stocknumber) {
		this.stocknumber = stocknumber;
	}
	public int getStatus() {
		return status;
	}
	public void setStatus(int status) {
		this.status = status;
	}
	public float getQuantity() {
		return quantity;
	}
	public void setQuantity(float quantity) {
		this.quantity = quantity;
	}
	public float getPrice() {
		return price;
	}
	public void setPrice(float price) {
		this.price = price;
	}
	public Timestamp getCreatetime() {
		return createtime;
	}
	public void setCreatetime(Timestamp createtime) {
		this.createtime = createtime;
	}
	public Long getType_id() {
		return type_id;
	}
	public void setType_id(Long type_id) {
		this.type_id = type_id;
	}
	public Long getUser_id() {
		return user_id;
	}
	public void setUser_id(Long user_id) {
		this.user_id = user_id;
	}
	public Long getAdmin_id() {
		return admin_id;
	}
	public void setAdmin_id(Long admin_id) {
		this.admin_id = admin_id;
	}
	public Long getWarehouse_id() {
		return warehouse_id;
	}
	public void setWarehouse_id(Long warehouse_id) {
		this.warehouse_id = warehouse_id;
	}
	public Long getSupply_id() {
		return supply_id;
	}
	public void setSupply_id(Long supply_id) {
		this.supply_id = supply_id;
	}
	public String getNote() {
		return note;
	}
	public void setNote(String note) {
		this.note = note;
	}
	
	/**
	 * 	取得一维码
	 * @return
	 */
	public java.util.List<Code> Code()
	{
		Type type = Type();
		if (type.getIscode()==UtilEnum.Type_Iscode.Iscode.getValue()&&getId()>0) 
		{
			Map<String, Object> map = new HashMap<String, Object>();
			map.put("list_id", getId());
			return (java.util.List<com.bems.pojo.Code>) new Code().getlist(map );
		}
		return null;
		
	}
	
	/**
	 *  取得List清单 存货的类型
	 * @return
	 */
	public Type Type()
	{
		if(getType_id()==null)
			 return null;
		return new Type().get(getType_id());
	}
 
	
	/**
	 * 取得用户
	 * @return
	 */
	public User User() 
	{
		if(getUser_id()==null)
			 return null;
		return new User().get(getUser_id());
		
	}
	
	/**
	 * 取得Admin用户
	 * @return
	 */
	public User Admin() {
		if(getAdmin_id()==null)
			 return null;
		return new User().get(getAdmin_id());
		
	}
	
	public Supply Supply() 
	{
		if(getSupply_id()==null)
			 return null;
		return new Supply().get(getSupply_id());
	}
	

	
	
}
